//---------------------------------------------------------------------------

#ifndef MainH
#define MainH
#define HIDEPAGE 6
#define SETPAGEINDEX  4
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Menus.hpp>
#include "DBGridEh.hpp"
#include "DBGridEhGrouping.hpp"
#include "GridsEh.hpp"
#include <ComCtrls.hpp>
#include <ExtCtrls.hpp>
#include <ToolWin.hpp>
#include <ImgList.hpp>
#include "main_Ghost.h"
#include "ModuleForm.h"
#include "AdvListV.hpp"
#include "DBAdvLst.hpp"
#include "EhLibADO.hpp"
#include "PrnDbgeh.hpp"
//#include "DBSumLst.hpp"
#include "AdvGrid.hpp"
#include "asgprint.hpp"
#include "BaseGrid.hpp"
#include <Dialogs.hpp>
#include <Grids.hpp>
#include "asgprev.hpp"
#include "trayicon.h"
#include "AdvCGrid.hpp"
#include "about.h"
#include "auAutoUpgrader.hpp"
#include "auHTTP.hpp"
#include "frxClass.hpp"
#include "frxCross.hpp"
#include <DB.hpp>
#include <DBTables.hpp>
#include "frxDBSet.hpp"
#include "dxBkgnd.hpp"
#include "dxPrnDev.hpp"
#include "dxPrnPg.hpp"
#include "dxPSBaseGridLnk.hpp"
#include "dxPSCompsProvider.hpp"
#include "dxPSCore.hpp"
#include "dxPSEdgePatterns.hpp"
#include "dxPSEngn.hpp"
#include "dxPSFillPatterns.hpp"
#include "dxPSGlbl.hpp"
#include "dxPSGrLnks.hpp"
#include "dxPSStdGrLnk.hpp"
#include "dxPSUtl.hpp"
#include "dxWrap.hpp"
#include "dxCntner.hpp"
#include "dxDBCtrl.hpp"
#include "dxDBGrid.hpp"
#include "dxExEdtr.hpp"
#include "dxTL.hpp"
#include "dxPSdxDBCtrlLnk.hpp"
#include "dxPSdxDBGrLnk.hpp"
#include "dxPSdxTLLnk.hpp"
#include "dxPgsDlg.hpp"
#include <DBGrids.hpp>
//---------------------------------------------------------------------------
class TfrmMain : public TForm
{
__published:	// IDE-managed Components
        TMainMenu *mmMain;
        TMenuItem *mniStart;
        TMenuItem *mniCtrl;
        TMenuItem *mniView;
        TMenuItem *mniSet;
        TMenuItem *mniHelp;
        TPanel *pnlTreeView;
        TSplitter *spl1;
        TToolBar *ToolBar1;
        TToolButton *btnlink;
        TToolButton *btnStop;
        TToolButton *btn1;
        TToolButton *btnSearch;
        TStatusBar *statMain;
        TImageList *ilMain;
        TToolButton *btnSet;
        TToolButton *btnHelp;
        TPanel *pnl1;
        TMenuItem *mniShowEdge;
        TToolButton *ToolButton1;
        TButton *btnGetBomGroup;
        TTreeView *tvBomGroup;
        TMenuItem *mniConServer;
        TMenuItem *mniClose;
        TMenuItem *mniShowBomEdge;
        TMenuItem *mniPrintFpBom;
        TMenuItem *mniPrintSfpBom;
        TMenuItem *mniExportFpBom;
        TMenuItem *mniExportSfpBom;
        TButton *btnBomPrice;
        TPrintDBGridEh *prntdbgrdhMain;
        TToolButton *btnPrice;
        TAdvGridPrintSettingsDialog *dlg1;
        TMenuItem *BOM1;
        TSaveDialog *SaveDialog1;
        TMenuItem *BOM2;
        TButton *btnGetMM;
        TTrayIcon *trycn1;
        TPopupMenu *pm1;
        TMenuItem *mniN9;
        TMenuItem *mniN10;
        TMenuItem *mniBOM3;
        TMenuItem *mniBOM4;
        TButton *btnPrintSet;
        TMenuItem *mniAllSet;
        TMenuItem *mniShowToolbar;
        TAdvPreviewDialog *dlgPreview;
        TPageControl *pgcMain;
        TTabSheet *ts1;
        TSplitter *spl2;
        TSplitter *spl4;
        TDBGridEh *dbgrdhBomChild;
        TPanel *pnl2;
        TSplitter *spl3;
        TDBGridEh *dbgrdhBomMainItem;
        TDBGridEh *dbgrdhBomBill;
        TDBGridEh *dbgrdhSfp;
        TTabSheet *tsBomList_Lib;
        TDBGridEh *dbgrdhBomLevelList;
        TTabSheet *ts2;
        TDBGridEh *dbgrdhBomUnflod;
        TTabSheet *ts5;
        TPageControl *pgcOrder;
        TTabSheet *tsOrderConfig;
        TSplitter *spl6;
        TPanel *pnl6;
        TPanel *pnl11;
        TLabel *lbl19;
        TLabel *lbl20;
        TLabel *lbl21;
        TLabel *lblOrderCode;
        TComboBox *cbbSelectFpType;
        TButton *btnCreateCode;
        TComboBox *cbbMMCode;
        TComboBox *cbbOrderCode;
        TPanel *pnl9;
        TPanel *pnl3;
        TTabSheet *ts7;
        TSplitter *spl8;
        TSplitter *spl9;
        TDBGridEh *dbgrdhMM;
        TDBGridEh *dbgrdhFpGet;
        TTabSheet *tsFlowChart;
        TAdvStringGrid *advstrngrdFlowChart;
        TTabSheet *tsMainSet;
        TGroupBox *grpPageSet;
        TPanel *pnlPrintSet;
        TLabel *lbl17;
        TLabel *lbl18;
        TComboBox *cbbPageHeadLeft;
        TComboBox *cbbPageHeadCenter;
        TComboBox *cbbPageHeadRight;
        TComboBox *cbbPageFootRight;
        TComboBox *cbbPageFootCenter;
        TComboBox *cbbPageFootLeft;
        TGroupBox *grpLibSet;
        TPanel *pnl10;
        TLabel *lbl1;
        TCheckBox *chkIsNoticeItem;
        TComboBox *cbbMainCode;
        TComboBox *cbbDataBase;
        TTabSheet *tsBOMList2;
        TSplitter *spl5;
        TAdvStringGrid *advstrngrdBomList;
        TAdvStringGrid *advstrngrdBomListAll;
        TTabSheet *tsBomPrice;
        TDBGridEh *dbgrdhBomPrice;
        TTabSheet *ts3;
        TMemo *mmoSqlBomGroup;
        TMemo *mmoBomMainItem;
        TMemo *mmoSqlBomList;
        TMemo *mmoBomListAll;
        TMemo *mmoSqlSfp;
        TTabSheet *ts4;
        TMemo *mmoSqlBomPrice;
        TMemo *mmoSqlPrice;
        TMemo *mmoSqlPriceInsert;
        TMemo *mmoBomList;
        TMemo *mmoBomList2;
        TMemo *mmoBomList0;
        TTabSheet *ts8;
        TMemo *mmoMM;
        TTabSheet *tsOrderCreate;
        TGroupBox *grpvender;
        TGroupBox *grpProduct;
        TLabel *lbl22;
        TGroupBox *grpDesign;
        TGroupBox *grpQulity;
        TGroupBox *grpProject;
        TGroupBox *grpProcure;
        TLabel *lbl6;
        TComboBox *cbbHandleModel;
        TLabel *lbl23;
        TLabel *lbl24;
        TComboBox *cbbHandleCode;
        TPanel *pnl8;
        TGroupBox *grpDoubleF;
        TComboBox *cbbF;
        TGroupBox *grpHandleF;
        TComboBox *cbbHandleF;
        TMemo *mmoF;
        TAdvStringGrid *advstrngrdOrder;
        TGroupBox *grpOther;
        TLabel *lbl13;
        TComboBox *cbbSpec;
        TComboBox *cbbGunModel;
        TLabel *lbl2;
        TLabel *lbl3;
        TLabel *lbl4;
        TComboBox *cbbGunCode;
        TLabel *Label1;
        TComboBox *cbbCtrlModel;
        TLabel *Label2;
        TLabel *Label3;
        TComboBox *cbbCtrlCode;
        TComboBox *cbbMassorModel;
        TLabel *Label4;
        TLabel *Label5;
        TLabel *Label6;
        TComboBox *cbbMassorCode;
        TButton *btnRConfig;
        TGroupBox *grpNote;
        TMemo *mmoNote;
        TGroupBox *grpOrderCtrl;
        TButton *btnShowOrder;
        TGroupBox *grpCtrlF;
        TComboBox *cbbCtrlF;
        TGroupBox *grpGunF;
        TComboBox *cbbGunF;
        TDateTimePicker *dtpData;
        TLabel *lbl5;
        TButton *btnGetF;
        TComboBox *cbbRudModel;
        TComboBox *cbbRudCode;
        TLabel *lbl7;
        TLabel *lbl8;
        TLabel *lbl9;
        TLabel *lbl10;
        TComboBox *cbbUdModel;
        TLabel *lbl11;
        TLabel *lbl12;
        TComboBox *cbbUdCode;
        TButton *btnSaveToExcel;
        TGroupBox *grpOrderCreate;
        TButton *btnAdvStringGrid;
        TButton *btnAdvStringGridPrint;
        TComboBox *cbbFpSX;
        TLabel *Label7;
        TLabel *lbl14;
        TComboBox *cbbFpTarget;
        TLabel *lbl15;
        TComboBox *cbbFS;
        TSaveDialog *dlgSaveOrder;
        TMenuItem *mniN1;
        TTabSheet *tsSearch;
        TGroupBox *grpSearchCtrl;
        TRadioGroup *rgSearchSelect;
        TComboBox *cbbSearch;
        TButton *btnSearchBom;
        TAdvStringGrid *advstrngrdSearch;
        TComboBox *cbbSearchCache;
        TAdvStringGrid *advstrngrdMM;
        TMemo *mmoSearch;
        TComboBox *cbbFinterID;
        TButton *btnBomStartList;
        TToolButton *btnLibExist;
        TDBGridEh *dbgrdhLibExist;
        TSplitter *spl7;
        TButton *btnMDLibExist;
        TMenuItem *mniHelpabout;
        TauAutoUpgrader *auAutoUpgrader1;
        TMenuItem *mniUpdata;
        TTabSheet *tsUpData;
        TButton *Button1;
        TProgressBar *ProgressBar1;
        TfrxCrossObject *frxCrossObject1;
        TfrxReport *frxReport1;
        TToolButton *btnPrintDb;
        TTable *Table1;
        TdxComponentPrinter *dxComponentPrinter1;
        TToolButton *btnDevPreview;
        TToolButton *btnDevPrint;
        TTabSheet *ts6;
        TdxStringGridReportLink *advstrngrdOrderEnPreview;
        TdxStringGridReportLink *advstrngrdSearchEnPreview;
        TTabSheet *tsBomListF;
        TAdvStringGrid *advSdBomListF;
        TdxStringGridReportLink *advSdBomListFEnPreview;
        TPopupMenu *pmBomListF;
        TMenuItem *pmAutoColWeight;
        TCheckBox *chkAutoSize;
        TToolButton *btn2;
        TMenuItem *mniBOMALL;
        TMemo *mmoBomList_Lib;
        TTabSheet *tsBomListLibExist;
        TDBGridEh *dbgrdhBomListLibExist;
        TMenuItem *mniSelect;
        TMenuItem *N1;
        TAdvStringGrid *advSdSubBom;
        TSplitter *spl10;
        TdxStringGridReportLink *advSdSubBomEnPreview;
        TCheckBox *chkSelectLine;
        void __fastcall mniShowEdgeClick(TObject *Sender);
        void __fastcall FormCreate(TObject *Sender);
        void __fastcall btnGetBomGroupClick(TObject *Sender);
        void __fastcall btnlinkClick(TObject *Sender);
        void __fastcall mniCtrlClick(TObject *Sender);
        void __fastcall mniShowBomEdgeClick(TObject *Sender);
        void __fastcall tvBomGroupClick(TObject *Sender);
        void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
        void __fastcall btnStopClick(TObject *Sender);
        void __fastcall dbgrdhBomBillCellClick(TColumnEh *Column);
        void __fastcall mniCloseClick(TObject *Sender);
        void __fastcall dbgrdhBomChildCellClick(TColumnEh *Column);
        void __fastcall mniPrintFpBomClick(TObject *Sender);
        void __fastcall mniPrintSfpBomClick(TObject *Sender);
        void __fastcall mniConServerClick(TObject *Sender);
        void __fastcall btnSearchClick(TObject *Sender);
        void __fastcall btnBomPriceClick(TObject *Sender);
        void __fastcall dbgrdhBomPriceTitleBtnClick(TObject *Sender,
          int ACol, TColumnEh *Column);
        void __fastcall btnPriceClick(TObject *Sender);
        void __fastcall btnAdvStringGridClick(TObject *Sender);
        void __fastcall btnAdvStringGridPrintClick(TObject *Sender);
        void __fastcall BOM1Click(TObject *Sender);
        void __fastcall mniExportFpBomClick(TObject *Sender);
        void __fastcall BOM2Click(TObject *Sender);
        void __fastcall mniExportSfpBomClick(TObject *Sender);
        void __fastcall btnGetMMClick(TObject *Sender);
        void __fastcall mniN9Click(TObject *Sender);
        void __fastcall mniN10Click(TObject *Sender);
        void __fastcall mniBOM3Click(TObject *Sender);
        void __fastcall mniBOM4Click(TObject *Sender);
        void __fastcall btnPrintSetClick(TObject *Sender);
        void __fastcall mniAllSetClick(TObject *Sender);
        void __fastcall mniShowToolbarClick(TObject *Sender);
        void __fastcall cbbSelectFpTypeChange(TObject *Sender);
        void __fastcall cbbMMCodeChange(TObject *Sender);
        void __fastcall cbbHandleModelChange(TObject *Sender);
        void __fastcall cbbHandleCodeChange(TObject *Sender);
        void __fastcall advstrngrdOrderGetEditorType(TObject *Sender, int ACol,
          int ARow, TEditorType &AEditor);
        void __fastcall btnRConfigClick(TObject *Sender);
        void __fastcall cbbGunModelChange(TObject *Sender);
        void __fastcall cbbGunCodeChange(TObject *Sender);
        void __fastcall cbbCtrlModelChange(TObject *Sender);
        void __fastcall cbbCtrlCodeChange(TObject *Sender);
        void __fastcall cbbMassorModelChange(TObject *Sender);
        void __fastcall cbbMassorCodeChange(TObject *Sender);
        void __fastcall btnShowOrderClick(TObject *Sender);
        void __fastcall btnGetFClick(TObject *Sender);
        void __fastcall btnSaveToExcelClick(TObject *Sender);
        void __fastcall btnCreateCodeClick(TObject *Sender);
        void __fastcall cbbRudModelChange(TObject *Sender);
        void __fastcall cbbRudCodeChange(TObject *Sender);
        void __fastcall cbbUdModelChange(TObject *Sender);
        void __fastcall cbbUdCodeChange(TObject *Sender);
        void __fastcall mniN1Click(TObject *Sender);
        void __fastcall cbbSearchChange(TObject *Sender);
        void __fastcall btnSearchBomClick(TObject *Sender);
        void __fastcall advstrngrdSearchDblClick(TObject *Sender);
        void __fastcall cbbSearchKeyPress(TObject *Sender, char &Key);
        void __fastcall btnBomStartListClick(TObject *Sender);
        void __fastcall btnLibExistClick(TObject *Sender);
        void __fastcall btnSetClick(TObject *Sender);
        void __fastcall btnHelpClick(TObject *Sender);
        void __fastcall dbgrdhBomLevelListCellClick(TColumnEh *Column);
        void __fastcall btnMDLibExistClick(TObject *Sender);
        void __fastcall dbgrdhBomLevelListSelectionChanged(
          TObject *Sender);
        void __fastcall dbgrdhLibExistColWidthsChanged(TObject *Sender);
        void __fastcall mniHelpaboutClick(TObject *Sender);
        void __fastcall dbgrdhBomBillColWidthsChanged(TObject *Sender);
        void __fastcall mniUpdataClick(TObject *Sender);
        void __fastcall Button1Click(TObject *Sender);
        void __fastcall auAutoUpgrader1Aborted(TObject *Sender);
        void __fastcall auAutoUpgrader1NoUpdateAvailable(TObject *Sender);
        void __fastcall auAutoUpgrader1Progress(TObject *Sender,
          const AnsiString FileURL, int FileSize, int BytesRead,
          int ElapsedTime, int EstimatedTimeLeft, BYTE PercentsDone,
          BYTE TotalPercentsDone, float TransferRate);
        void __fastcall frxReport1BeforePrint(TfrxReportComponent *Sender);
        void __fastcall btnPrintDbClick(TObject *Sender);
        void __fastcall btnDevPreviewClick(TObject *Sender);
        void __fastcall btnDevPrintClick(TObject *Sender);
        void __fastcall advSdBomListFComboChange(TObject *Sender, int ACol,
          int ARow, int AItemIndex, AnsiString ASelection);
        void __fastcall advSdBomListFGetEditorType(TObject *Sender,
          int ACol, int ARow, TEditorType &AEditor);
        void __fastcall advSdBomListFHasComboBox(TObject *Sender, int ACol,
          int ARow, bool &HasComboBox);
        void __fastcall pmAutoColWeightClick(TObject *Sender);
        void __fastcall mniBOMALLClick(TObject *Sender);
        void __fastcall mniSelectClick(TObject *Sender);
        void __fastcall N1Click(TObject *Sender);
        void __fastcall advSdBomListFDblClick(TObject *Sender);
        void __fastcall dxComponentPrinter1AfterPreview(TObject *Sender,
          TBasedxReportLink *AReportLink);
        void __fastcall chkSelectLineClick(TObject *Sender);



        //void __fastcall advstrngrdBomListDrawCell(TObject *Sender,
        //  int ACol, int ARow, TRect &Rect, TGridDrawState State);
private:	// User declarations
public:		// User declarations
        __fastcall TfrmMain(TComponent* Owner);
        void __fastcall AddTree(TTreeNode *ParentNode);
       void __fastcall advstrngrdBomListDrawCell(TObject *Sender, int ACol,
          int ARow, TRect &Rect, Grids::TGridDrawState  State);
       void __fastcall dbgrdhBomLevelListGetCellParams(TObject *Sender,
          TColumnEh *Column, TFont *AFont, TColor &Background,
          Grids::TGridDrawState State);
      void __fastcall qryConfigGet(AnsiString Str);
      void __fastcall advstrngrdOrderDrawCell(TObject *Sender, int ACol,
      int ARow, TRect &Rect, Grids::TGridDrawState State);
       void __fastcall advstrngrdSearchDrawCell(TObject *Sender,
      int ACol, int ARow, TRect &Rect, Grids::TGridDrawState State);
void __fastcall advstrngrdMMDrawCell(TObject *Sender,
      int ACol, int ARow, TRect &Rect, Grids::TGridDrawState State);
 void __fastcall advSdBomListFDrawCell(TObject *Sender,
      int ACol, int ARow, TRect &Rect, Grids::TGridDrawState State);
 void __fastcall advSdSubBomDrawCell(TObject *Sender,
      int ACol, int ARow, TRect &Rect, Grids::TGridDrawState State);
          void __fastcall advSdBomListFGetCellColor(TObject *Sender,
          int ARow, int ACol, Grids::TGridDrawState, TBrush *ABrush,
          TFont *AFont);

};
//---------------------------------------------------------------------------
extern PACKAGE TfrmMain *frmMain;
//---------------------------------------------------------------------------
#endif
